package com.atguigu.eduservice.util;

/**
 * @ClassName StrUtils
 * @Description: TODO
 * @Author: NeySun
 * @Create: 2022-10-31 15:11
 * @Version 1.0
 **/
public class StrUtils {

    public static boolean isBase64(String str) {
        if (str == null || str.trim().length() == 0) {
            return false;
        } else {
            if (str.length() % 4 != 0) {
                return false;
            }

            char[] strChars = str.toCharArray();
            for (char c:strChars) {
                if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')
                        || c == '+' || c == '/' || c == '=') {
                    continue;
                } else {
                    return false;
                }
            }
            return true;
        }
    }

}